package cn.golxen.rsms.config;

import cn.golxen.rsms.service.WxService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Slf4j
@EnableScheduling
@Configuration
public class ScheduledTaskConfig {
    @Autowired
    WxService wxService;

    @Scheduled(cron = "0 0 8,20 * * *")
    public void sendStoreOffersExecute(){
        log.info("开始向顾客发送资讯定时任务...");
        wxService.sendStoreOffers();
        log.info("向顾客发送资讯定时任务完成");

    }

    @Scheduled(cron = "0 0 8 * * *")
    public void sendBusinessExecute(){
        log.info("开始向用户发送生意概况定时任务...");
        wxService.sendBusiness();
        log.info("向用户发送生意概况定时任务完成");

    }
}
